{% sw_extends '@Storefront/storefront/page/account/_page.html.twig' %}

{% block page_account_main_content %}
    <div class="account-address account-address-form">
        {# @deprecated tag:v6.8.0 - Block page_account_address_form_welcome is superfluous, use page_account_address_form_welcome_headline. #}
        {% block page_account_address_form_welcome %}
            {% block page_account_address_form_welcome_headline %}
                <h1 class="account-welcome">
                    {{ 'account.addressEditMetaTitle'|trans|sw_sanitize }}
                </h1>
            {% endblock %}
        {% endblock %}

        {% block page_account_address_form_main %}
            <div class="card">
                <div class="card-body">
                    {% block page_account_address_form_edit %}
                        <form method="post"
                              action="{{ path('frontend.account.address.edit.save', { addressId: page.address.id }) }}"
                              data-form-handler="true">
                            {% block page_account_address_form_edit_personal %}
                                {% sw_include '@Storefront/storefront/component/address/address-personal.html.twig' with {
                                    data: page.address,
                                    prefix: 'address'
                                } %}
                            {% endblock %}

                            {% block page_account_address_form_edit_general %}
                                {% sw_include '@Storefront/storefront/component/address/address-form.html.twig' with {
                                    data: page.address,
                                    prefix: 'address',
                                    showFormCompany: true,
                                    showNoShippingPostfix: true,
                                    scopeElementSelector: '.account-address-form',
                                } %}
                            {% endblock %}

                            {% block page_account_address_required %}
                                <p class="address-required-info required-fields">
                                    {{ 'general.requiredFields'|trans|sw_sanitize }}
                                </p>
                            {% endblock %}

                            {% block page_account_address_form_redirect %}
                                <input type="hidden" name="redirectTo" value="{{ redirectTo }}">
                            {% endblock %}

                            {% block page_account_address_action_buttons %}
                                <div class="address-form-actions d-flex justify-content-between">
                                    {% block page_account_address_action_button_back %}
                                        <a href="{{ path('frontend.account.address.page') }}"
                                           class="account-address-back btn btn-outline-secondary"
                                           aria-label="{{ 'general.back'|trans|striptags }}">
                                            {% sw_icon 'arrow-left' %}
                                            <span class="d-none d-sm-inline">{{ 'general.back'|trans|sw_sanitize }}</span>
                                        </a>
                                    {% endblock %}

                                    {% block page_account_address_action_button_send %}
                                        <button type="submit"
                                                class="address-form-submit btn btn-primary"
                                                title="{{ 'account.addressSaveChange'|trans|striptags }}">
                                            {{ 'account.addressSaveChange'|trans|sw_sanitize }}
                                        </button>
                                    {% endblock %}
                                </div>
                            {% endblock %}
                        </form>
                    {% endblock %}
                </div>
            </div>
        {% endblock %}
    </div>
{% endblock %}
